<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>付款登记</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link href="css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=path%>/script/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="script/jquery-1.8.1.min.js"></script>
	<script type="text/javascript" src="script/common.js"></script>
	
	<script type="text/javascript">
	
		$(function(){
			//初始化首页
			goPage(1,"");
		}); 
		
		function goPage(currentPage, payType) {
			$("#paytype").val(payType)
			payType = $("#paytype").val()
			var params = {
				"currentPage" : currentPage,
				"payType" : payType,
			};
			$("#dataList").load("main/finance/paymentIndex",params);
		}
		
		function queryPage(currentPage){
			var poid = $.trim($("#poid").val());
			var name = $.trim($("#name").val());
			var startDate = $.trim($("#startDate").val());
			var endDate = $.trim($("#endDate").val());
			
			$("#dataList").load("<%=path%>/main/finance/paymentIndex?currentPage="+currentPage+"&poid="+poid+"&name="+name+"&startDate="+startDate+"&endDate="+endDate);
		}
		//付款登记
		function payment(poid,type){
			if(confirm("确定要操作吗？")){
				$.post("main/finance/payment",{"poid":poid,"type":type},function(data){
					if(data == "ok"){
						alert("登记成功！")
						goPage($("#currentPage").text());//刷新页面
					}else{
						alert("登记失败！")
					}
				});
			}
		}
	</script>
  </head>
  
  <body>
    <div id="pomain">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td class="title1">您的位置：财务收支－－付款登记</td>
			</tr>
		</table>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td width="80px" class="toolbar" onMouseOver="OMO(event)" onMouseOut="OMOU(event)" onclick="goPage(1,1)">货到付款</td>
				<td width="20px" nowrap class="toolbar">|</td>
				<td width="80px" class="toolbar" onMouseOver="OMO(event)" onMouseOut="OMOU(event)" onclick="goPage(1,2)" >款到发货</td>
				<td width="20px" nowrap class="toolbar">|</td>
				<td width="90px" class="toolbar" onMouseOver="OMO(event)" onMouseOut="OMOU(event)" onclick="goPage(1,3)">预付款到发货</td>
				<td width="20px" nowrap class="toolbar">|</td>
				<td class="toolbar">&nbsp;</td>
			</tr>
		</table>
	</div>
		<%
			//查询条件
			String poid = request.getParameter("poid");
			String name = request.getParameter("name");
			String payType = request.getParameter("payType");
			String startDate = request.getParameter("startDate");
			String endDate = request.getParameter("endDate");

			poid = poid == null ? "" : poid;
			name = name == null ? "" : name;
			payType = payType == null ? "" : payType;
			startDate = startDate == null ? "" : startDate;
			endDate = endDate == null ? "" : endDate;
		%>
		<div class="queryDiv">
			采购单编号：<input type="text" id="poid" value="<%=poid%>" /> 
			供应商名称：<input type="text" id="name" value="<%=name%>" /> 
			日期段： <input class="Wdate" type="text" id="startDate" value="<%=startDate%>" onFocus="WdatePicker({isShowClear:true,readOnly:true})" /> 
					- 
					<input class="Wdate" type="text" id="endDate" value="<%=endDate%>" onFocus="WdatePicker({isShowClear:true,readOnly:true})" /> 
			<input type="button" value="查询" onclick="queryPage(1)" />
			<input type="hidden" value="<%=payType%>" id="paytype">
		</div>
		<div id="dataList"></div>
  </body>
</html>
